package ${packageName};

import epoch.game.core.distributed.annotation.ServProxy;
import epoch.game.core.distributed.service.AbstractProxy;
import epoch.game.core.function.*;

${importPackages}

/**
 * 服务代理，代码自动生成,请勿手动修改
 * 
 * @author CodeGenerator
 * 
 */
@ServProxy(${iService}.class)
public class ${serviceImpl} extends AbstractProxy implements ${iService} {
	
	public ${serviceImpl}(){
	
	}

	public ${serviceImpl}(int serviceId, int remoteNodeId){
		this.remoteNodeId = remoteNodeId;
		this.servId = serviceId;
	}

	public enum MethodEnum {
		<#list methodList as item>
		${item.enums}((short) ${item_index + 1}),
		</#list>
		;
		final short key;

		private MethodEnum(short methodKey) {
			this.key = methodKey;
		}

		public short getKey() {
			return key;
		}
	}

	/**
	 * 获取服务方法指针
	 * 
	 * @param service
	 * @param methodKey
	 * @return
	 */
	public static Object getServiceMethod(${iService} service, short methodKey) {
		<#list methodList as item>
		if (methodKey == MethodEnum.${item.enums}.key) {
			return ${item.methodReturn};
		} else 
		</#list>
		return null;
	}
	<#list methodList as item>

	@Override
	public void ${item.methodName}(${item.parama}) {
		sendCall(MethodEnum.${item.enums}.key, new Object[]{${item.paramb}});
	}
	</#list>
}